﻿@using ccgstore.WebApp.Models
@model IEnumerable<User>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Users</h2>

<fieldset>
    <legend>User</legend>

    <table>
        <tr>
            <th>Username</th>
            <th>Name</th>
            <th>Email</th>
            <th>Role</th>
            <th></th>
        </tr>

        @foreach (var user in Model)
        {             
            <tr>
                <td>@user.Username</td>
                <td>@user.Name</td>
                <td>@user.Email</td>
                <td>@user.PrintRoles()</td>
                <td>@user.Password</td>
                @if (Roles.Provider.IsUserInRole(User.Identity.Name, "Admin"))
                {
                    <td>@Html.ActionLink("Edit", "Edit", new { id = user.UserId })</td>
                }             
            </tr>                    
        }
    </table>



</fieldset>


